import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui'
import VueI18n from 'vue-i18n'
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import 'element-ui/lib/theme-chalk/index.css'
import '@/style/global.less'

Vue.config.productionTip = false
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})
Vue.use(VueI18n)

// /*---------使用语言包-----------*/
const i18n = new VueI18n({
  locale: 'zh-CN',
  // this.$i18n.locale // 通过切换locale的值来实现语言切换
  messages: {
    'zh-CN': Object.assign(require('@/utils/lang/zh'), zhLocale), // 中文语言包
    'en-US': Object.assign(require('@/utils/lang/en'), enLocale) // 英文语言包
  }
})

new Vue({
  router,
  i18n,
  render: h => h(App)
}).$mount('#app')
